The following example demonstrates how to provide, through a style, a new ControlTemplate for the DataCells that will display the cells as buttons.
XAML |
Copy Code |
---|---|
<Grid xmlns:xcdg="http://schemas.xceed.com/wpf/xaml/datagrid"> <Grid.Resources> <Style TargetType="{x:Type xcdg:DataCell}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type xcdg:DataCell}"> <Button> <Button.Content> <ContentPresenter/> </Button.Content> </Button> </ControlTemplate> </Setter.Value> </Setter> </Style> <xcdg:DataGridCollectionViewSource x:Key="cvs_orders" Source="{Binding Source={x:Static Application.Current}, Path=Orders}"/> </Grid.Resources> <xcdg:DataGridControl x:Name="OrdersGrid" ItemsSource="{Binding Source={StaticResource cvs_orders}}"/> </Grid> |